package com.qf.smsplatform.controller;
/*2021/10/30*/

import com.github.pagehelper.PageInfo;
import com.qf.smsplatform.dto.R;
import com.qf.smsplatform.pojo.TAcountRecord;
import com.qf.smsplatform.service.TAcountRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sun.reflect.generics.tree.ReturnType;

/**
 * @YuTao
 */
@RestController
@RequestMapping("/record")
@Api(tags = "充值记录管理")
public class TAcountRecordController {

    private TAcountRecordService tAcountRecordService;
    @Autowired
    public void settAcountRecordService(TAcountRecordService tAcountRecordService) {
        this.tAcountRecordService = tAcountRecordService;
    }
    @ApiOperation("充值记录分页查询")
    @GetMapping("/page")//消费记录表的分页查询
    public R selectPage(int pageNum,int pageSize){
        PageInfo<TAcountRecord> pageInfo = tAcountRecordService.selectPage(pageNum, pageSize);
        return R.setOk(pageInfo);
    }
    @ApiOperation("充值订单信息更新")
    @PostMapping("/update")//对消费记录表的信息进行修改
    public R updateRecord(TAcountRecord acountRecord){
        tAcountRecordService.updateTAcount(acountRecord);
        return R.setOk();
    }
    @ApiOperation("充值订单信息添加")
    @PostMapping("/insert")//增加消费记录表的信息 @RequestBody
    public R insertRecord(TAcountRecord tAcountRecord){
        tAcountRecordService.insertTAcount(tAcountRecord);
        return R.setOk();
    }
    @ApiOperation("动态参数查询")
    @PostMapping("/multParams")
    public R selectByMultParams(TAcountRecord tAcountRecord) throws InstantiationException, IllegalAccessException {
        PageInfo<TAcountRecord> pageInfo = tAcountRecordService.selectByMultParams(tAcountRecord);
        return R.setOk(pageInfo);
    }

}
